/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FRProductos.java
 *
 * Created on Nov 1, 2011, 7:38:42 PM
 */

package Interfaz;

import Negocio.UI.UIPuntoVenta;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
 * @author Marco
 */
public class FRProductos extends javax.swing.JFrame {

    private UIPuntoVenta uiPuntoVenta = UIPuntoVenta.getInstancia();

    public UIPuntoVenta getUiPuntoVenta() {
        return uiPuntoVenta;
    }

    public void setUiPuntoVenta(UIPuntoVenta uiPuntoVenta) {
        this.uiPuntoVenta = uiPuntoVenta;
    }

    public JLabel getjLabel4() {
        return jLabel4;
    }

    public void setjLabel4(JLabel jLabel4) {
        this.jLabel4 = jLabel4;
    }

    public JTextField getTxtComBailarina() {
        return txtComBailarina;
    }

    public void setTxtComBailarina(JTextField txtComBailarina) {
        this.txtComBailarina = txtComBailarina;
    }

    /** Creates new form FRProductos */
    public FRProductos() {
        initComponents();
        setSize(800, 600);
        setLocationRelativeTo(this);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton3 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        txtPrecio = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        TextArea = new javax.swing.JTextArea();
        txtComBailarina = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel48 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        listaProductos = new javax.swing.JList();
        bAgregar = new javax.swing.JButton();
        bEliminar = new javax.swing.JButton();
        bModificar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        bMenuPrincipal = new javax.swing.JButton();

        jButton3.setText("Agregar");

        jButton5.setText("Modificar");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setLayout(null);

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
        jPanel2.setLayout(null);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel2.setText("Nombre del producto:");
        jPanel2.add(jLabel2);
        jLabel2.setBounds(10, 20, 160, 44);

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel3.setText("Comision Bailarina:");
        jPanel2.add(jLabel3);
        jLabel3.setBounds(10, 110, 160, 44);
        jPanel2.add(txtNombre);
        txtNombre.setBounds(200, 30, 280, 30);
        jPanel2.add(txtPrecio);
        txtPrecio.setBounds(200, 70, 280, 30);

        TextArea.setColumns(20);
        TextArea.setFont(new java.awt.Font("Monospaced", 0, 18));
        TextArea.setRows(5);
        TextArea.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 0), 1, true));
        TextArea.setDisabledTextColor(new java.awt.Color(204, 0, 0));
        TextArea.setEnabled(false);
        jScrollPane2.setViewportView(TextArea);

        jPanel2.add(jScrollPane2);
        jScrollPane2.setBounds(10, 170, 470, 120);

        txtComBailarina.setText("0");
        jPanel2.add(txtComBailarina);
        txtComBailarina.setBounds(200, 110, 280, 30);

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel4.setText("Costo:");
        jPanel2.add(jLabel4);
        jLabel4.setBounds(10, 70, 160, 44);

        jPanel1.add(jPanel2);
        jPanel2.setBounds(10, 10, 500, 310);

        jLabel48.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel48.setText("Producto:");
        jPanel1.add(jLabel48);
        jLabel48.setBounds(530, 10, 134, 15);

        listaProductos.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
        listaProductos.setFont(new java.awt.Font("MS Reference Sans Serif", 0, 18));
        listaProductos.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        listaProductos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaProductosMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(listaProductos);

        jPanel1.add(jScrollPane3);
        jScrollPane3.setBounds(530, 30, 240, 290);

        bAgregar.setFont(new java.awt.Font("MS Reference Sans Serif", 1, 18));
        bAgregar.setForeground(new java.awt.Color(0, 102, 0));
        bAgregar.setText("Agregar");
        bAgregar.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 153, 0), 2, true));
        bAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bAgregarActionPerformed(evt);
            }
        });
        jPanel1.add(bAgregar);
        bAgregar.setBounds(10, 330, 240, 110);

        bEliminar.setFont(new java.awt.Font("MS Reference Sans Serif", 1, 18));
        bEliminar.setForeground(new java.awt.Color(153, 0, 0));
        bEliminar.setText("Eliminar");
        bEliminar.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 0, 0), 2, true));
        bEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bEliminarActionPerformed(evt);
            }
        });
        jPanel1.add(bEliminar);
        bEliminar.setBounds(270, 330, 240, 110);

        bModificar.setFont(new java.awt.Font("MS Reference Sans Serif", 1, 18));
        bModificar.setForeground(new java.awt.Color(0, 0, 102));
        bModificar.setText("Modificar");
        bModificar.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 2, true));
        bModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bModificarActionPerformed(evt);
            }
        });
        jPanel1.add(bModificar);
        bModificar.setBounds(530, 330, 240, 110);

        jPanel3.setBackground(new java.awt.Color(0, 102, 102));

        jLabel1.setFont(new java.awt.Font("Microsoft JhengHei", 1, 18));
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Gestionar Productos");

        bMenuPrincipal.setBackground(new java.awt.Color(255, 255, 255));
        bMenuPrincipal.setFont(new java.awt.Font("MS Reference Sans Serif", 1, 18));
        bMenuPrincipal.setForeground(new java.awt.Color(0, 51, 51));
        bMenuPrincipal.setText("Menú Principal");
        bMenuPrincipal.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 2, true));
        bMenuPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bMenuPrincipalActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(bMenuPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(306, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                    .addComponent(bMenuPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 791, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void listaProductosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaProductosMouseClicked
        uiPuntoVenta.productoSeleccionado();// TODO add your handling code here:
    }//GEN-LAST:event_listaProductosMouseClicked

    private void bMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bMenuPrincipalActionPerformed
        uiPuntoVenta.limpiarInfoProductos(this);
        uiPuntoVenta.framePrincipalProductos();        // TODO add your handling code here:
    }//GEN-LAST:event_bMenuPrincipalActionPerformed

    private void bAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAgregarActionPerformed
        uiPuntoVenta.insertarProducto();        // TODO add your handling code here:
    }//GEN-LAST:event_bAgregarActionPerformed

    private void bEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bEliminarActionPerformed
        uiPuntoVenta.eliminarProducto();// TODO add your handling code here:
    }//GEN-LAST:event_bEliminarActionPerformed

    private void bModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bModificarActionPerformed
        uiPuntoVenta.modificarProducto();// TODO add your handling code here:
    }//GEN-LAST:event_bModificarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FRProductos().setVisible(true);
            }
        });
    }

    public JTextArea getTextArea() {
        return TextArea;
    }

    public JButton getbAgregar() {
        return bAgregar;
    }

    public JButton getbEliminar() {
        return bEliminar;
    }

    public JButton getbMenuPrincipal() {
        return bMenuPrincipal;
    }

    public JButton getbModificar() {
        return bModificar;
    }
    public JButton getjButton3() {
        return jButton3;
    }

    public JButton getjButton5() {
        return jButton5;
    }

    public JLabel getjLabel1() {
        return jLabel1;
    }

    public JLabel getjLabel2() {
        return jLabel2;
    }

    public JLabel getjLabel3() {
        return jLabel3;
    }

    public JLabel getjLabel48() {
        return jLabel48;
    }

    public JPanel getjPanel1() {
        return jPanel1;
    }

    public JPanel getjPanel2() {
        return jPanel2;
    }

    public JPanel getjPanel3() {
        return jPanel3;
    }

    public JScrollPane getjScrollPane2() {
        return jScrollPane2;
    }

    public JScrollPane getjScrollPane3() {
        return jScrollPane3;
    }

    public JList getListaProductos() {
        return listaProductos;
    }

    public JTextField getTxtNombre() {
        return txtNombre;
    }

    public JTextField getTxtPrecio() {
        return txtPrecio;
    }




    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea TextArea;
    private javax.swing.JButton bAgregar;
    private javax.swing.JButton bEliminar;
    private javax.swing.JButton bMenuPrincipal;
    private javax.swing.JButton bModificar;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JList listaProductos;
    private javax.swing.JTextField txtComBailarina;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtPrecio;
    // End of variables declaration//GEN-END:variables

}
